from pydantic import BaseModel, field_validator


class Item(BaseModel):
    name: str
    description: str = None
    price: float
    tax: float = None


class Choice(BaseModel):
    language: str
    question: str
    A: str
    B: str
    C: str
    D: str = None
    answer: str = None

    @field_validator('question', 'A','B','C')
    def check_empty_string(cls, v, field):
        if not v.strip():
            raise ValueError(f"Field  cannot be an empty string")
        return v


class Word(BaseModel):
    language: str
    question: str
    answer: str = None

    @field_validator('question')
    def check_empty_string(cls, v, field):
        if not v.strip():
            raise ValueError(f"Field  cannot be an empty string")
        return v